package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.RepeatSubmit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.AdvMembersmsg;
import com.ruoyi.service.IAdvMembersmsgService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * Controller
 *
 * @author ruoyi
 * @date 2024-06-04
 */
@RestController
@RequestMapping("/system/membersmsg")
public class AdvMembersmsgController extends BaseController
{
    @Autowired
    private IAdvMembersmsgService advMembersmsgService;

    /**
     * 查询列表
     */

    @PreAuthorize("@ss.hasPermi('system:membersmsg:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdvMembersmsg advMembersmsg)
    {
        startPage();
        List<AdvMembersmsg> list = advMembersmsgService.selectAdvMembersmsgList(advMembersmsg);
        return getDataTable(list);
    }

    /**
     * 导出列表
     */

    @PreAuthorize("@ss.hasPermi('system:membersmsg:export')")
    @Log(title = "", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AdvMembersmsg advMembersmsg)
    {
        List<AdvMembersmsg> list = advMembersmsgService.selectAdvMembersmsgList(advMembersmsg);
        ExcelUtil<AdvMembersmsg> util = new ExcelUtil<AdvMembersmsg>(AdvMembersmsg.class);
        util.exportExcel(response, list, "数据");
    }

    /**
     * 获取详细信息
     */

    @PreAuthorize("@ss.hasPermi('system:membersmsg:query')")
    @GetMapping(value = "/{advMembersmsg}")
    public AjaxResult getInfo(@PathVariable("advMembersmsg") Long advMembersmsg)
    {
        return success(advMembersmsgService.selectAdvMembersmsgByAdvMembersmsg(advMembersmsg));
    }

    /**
     * 新增
     */
    @RepeatSubmit
    @PreAuthorize("@ss.hasPermi('system:membersmsg:add')")
    @Log(title = "", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdvMembersmsg advMembersmsg)
    {
        return toAjax(advMembersmsgService.insertAdvMembersmsg(advMembersmsg));
    }

    /**
     * 修改
     */

    @PreAuthorize("@ss.hasPermi('system:membersmsg:edit')")
    @Log(title = "", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdvMembersmsg advMembersmsg)
    {
        return toAjax(advMembersmsgService.updateAdvMembersmsg(advMembersmsg));
    }

    /**
     * 删除
     */

    @PreAuthorize("@ss.hasPermi('system:membersmsg:remove')")
    @Log(title = "", businessType = BusinessType.DELETE)
	@DeleteMapping("/{advMembersmsgs}")
    public AjaxResult remove(@PathVariable Long[] advMembersmsgs)
    {
        return toAjax(advMembersmsgService.deleteAdvMembersmsgByAdvMembersmsgs(advMembersmsgs));
    }
}
